package date;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author LIBOFEI
 * @ClassName DayAdd
 * @description
 * @date 2021/7/2 15:16
 * @Version 1.0
 **/
public class DayAdd  {

    public static void main(String[] args) {
        Calendar cl = Calendar.getInstance();
        cl.setTime(new Date());
        cl.add(Calendar.DAY_OF_MONTH, 1);//这里就是月份的相加
//        cl.add(Calendar.DAY_OF_MONTH, 20);//这里就是月份的相加
        Date date = cl.getTime();//获取到相加后的时间
        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(s.format(date));



        Calendar c2 = Calendar.getInstance();
        c2.setTime(new Date());
        c2.add(Calendar.DAY_OF_MONTH, 1);
        c2.set(Calendar.HOUR_OF_DAY,0);
        c2.set(Calendar.MINUTE,0);
        c2.set(Calendar.SECOND,0);

        Calendar c3 = Calendar.getInstance();
        c3.setTime(new Date());
        c3.add(Calendar.DAY_OF_MONTH, 60 + 1);
        c3.set(Calendar.HOUR_OF_DAY,23);
        c3.set(Calendar.MINUTE,59);
        c3.set(Calendar.SECOND,59);
        System.out.println(s.format(c2.getTime()));
        System.out.println(s.format(c3.getTime()));
    }
}
